package com.bsy.videostation.model.res

import android.os.Parcel
import android.os.Parcelable

data class UserInfo(
    val email: String? = null,
    val expiresIn: Int? = null,
    val knife4jPassword: String? = null,
    val loginName: String? = null,
    val token: String? = null,
    val userId: Int? = null,
    val userName: String? = null
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(email)
        parcel.writeValue(expiresIn)
        parcel.writeString(knife4jPassword)
        parcel.writeString(loginName)
        parcel.writeString(token)
        parcel.writeValue(userId)
        parcel.writeString(userName)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<UserInfo> {
        override fun createFromParcel(parcel: Parcel): UserInfo {
            return UserInfo(parcel)
        }

        override fun newArray(size: Int): Array<UserInfo?> {
            return arrayOfNulls(size)
        }
    }
}